package com.simple.datax.db.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.simple.datax.db.mybatis.client.DataxReceiveChannelMapper;
import com.simple.datax.db.mybatis.model.DataxReceiveChannel;
import com.simple.datax.db.mybatis.model.DataxReceiveChannelCriteria;
import com.simple.datax.db.service.MessageReceiveConfigService;

/**
 * @Title: MessageReceiveConfigServiceImpl.java
 * @Package com.simple.datax.db.service.impl
 * @Description: 数据库接收者配置信息服务
 * @author Paladin Chen
 * @date 2012-12-20 下午3:12:54
 * @version V1.0
 */
@Service("mrcService")
public class MessageReceiveConfigServiceImpl implements
		MessageReceiveConfigService {

	@Autowired
	private DataxReceiveChannelMapper mrcMapper;

	public List<DataxReceiveChannel> getDataxReceiveChannel(String node,
			String communType, short group, String way) {
		DataxReceiveChannelCriteria example = new DataxReceiveChannelCriteria();
		example.createCriteria().andCommunTypeEqualTo(communType)
				.andGroupEqualTo(group);
		return mrcMapper.selectByExample(example);
	}

	@Transactional
	public int insert(DataxReceiveChannel mrc) {
		return mrcMapper.insertSelective(mrc);
	}
}
